UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dC/FGHshQDMk1MDkPhzwmyd5SQE/uR60Q631Pz36sRs=' 
WHERE 
  key_id = '5a9c32503d0d1d1305c677b91c704ab2d1c840e98d2734e79f2bd4ff807d3bd0' 
  AND (
    token = 'dC/FGHshQDMk1MDkPhzwmyd5SQE/uR60Q631Pz36sRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016