UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cRuj7QQM+d2IOvvv8ftT82VTRcxtQbRWWkb5NmkeFT8=' 
WHERE 
  key_id = 'ccb030b6fec6e931922922409ca36b0bd2f435525629dcadb0c8f196f846f379' 
  AND (
    token = 'cRuj7QQM+d2IOvvv8ftT82VTRcxtQbRWWkb5NmkeFT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034