UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uPJ1OGLI0I/8yFsuD+f0I4Lf4KNvUvxAeDUHJS8CGrM=' 
WHERE 
  key_id = 'c609289da1f0ecb1559765d156368f69748f57106e55dcb26e90386cfa1ef804' 
  AND (
    token = 'uPJ1OGLI0I/8yFsuD+f0I4Lf4KNvUvxAeDUHJS8CGrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021