UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MUwYG0n5zx1Qn0dyVSgVImeklU316HzQu3bOeUNahDE=' 
WHERE 
  key_id = 'b75903c53b0cb1a022189cd8f57134bc762251c9395f581d02dc74e3a6e41c26' 
  AND (
    token = 'MUwYG0n5zx1Qn0dyVSgVImeklU316HzQu3bOeUNahDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00075