UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5MzNhK1Hz/qArLtCpdAY3sv0U41aBBEbz3TGjP86Vls=' 
WHERE 
  key_id = '4a8cbccf6564668082355a2ac414c353f750aaae70c525a8b2d9fb912359440f' 
  AND (
    token = '5MzNhK1Hz/qArLtCpdAY3sv0U41aBBEbz3TGjP86Vls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029