UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hj2JXARetjoymLTHsrq1L/FmN43WVs9/IPws7Y6kocE=' 
WHERE 
  key_id = '291b5d0b4e8d4f6a19c2113aaf7e28c111706d1ec8e90c7d828a035564127a09' 
  AND (
    token = 'hj2JXARetjoymLTHsrq1L/FmN43WVs9/IPws7Y6kocE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033