UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vTwJ36bfGLAfl65qw4FXJAiN4q2myEbyGLoo+rNNSZs=' 
WHERE 
  key_id = '2c47f607e4c49bf28324123b678b1369776edf8349c6386cc4b420e9931dda38' 
  AND (
    token = 'vTwJ36bfGLAfl65qw4FXJAiN4q2myEbyGLoo+rNNSZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034