UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'phpOOtXEROAdCkEi/0O+DGIuVyGXrqWS/x39qfLvQvw=' 
WHERE 
  key_id = '031fcc573c5f2a0c9f4d73755a11412800375668777efaf3477f533fd1f7ff9f' 
  AND (
    token = 'phpOOtXEROAdCkEi/0O+DGIuVyGXrqWS/x39qfLvQvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028