UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W97kaztYRI1BAkbF95/a13N8DSNjuD9OrWGo8eZkNUY=' 
WHERE 
  key_id = 'c13afee17729f7d6b02a200f02b0cc33e83bc74177683826671c6caadef97fe6' 
  AND (
    token = 'W97kaztYRI1BAkbF95/a13N8DSNjuD9OrWGo8eZkNUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043