UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PbJDJ3T/BGSLRyYCUP4wU5kFdPuam63X0EJU2NJvbJw=' 
WHERE 
  key_id = '20faa5792c091d703666eb274074577e899e15a067170262732ef99043457290' 
  AND (
    token = 'PbJDJ3T/BGSLRyYCUP4wU5kFdPuam63X0EJU2NJvbJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023