UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5rUo/dgRWZ7uJjv6zlffw/MFEMImBU83v5YjZzHbz5s=' 
WHERE 
  key_id = '8cfae963aabc51ea1f05acacfd33936cc223269f00120cacba93036e4f2b89c5' 
  AND (
    token = '5rUo/dgRWZ7uJjv6zlffw/MFEMImBU83v5YjZzHbz5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023