UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BShSfBMJJ/4Y+xp5k/d5QBXEIMA1BG+HO5ewkNF7njA=' 
WHERE 
  key_id = '5f8d56dc4552bb0b810ef4be70b49b12fca1e3296d94a70358fa2dba1ed90591' 
  AND (
    token = 'BShSfBMJJ/4Y+xp5k/d5QBXEIMA1BG+HO5ewkNF7njA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038