UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sm03nx7fkw3Pj5UJEPiocmU64RN5w8PmDUoZpAm43hQ=' 
WHERE 
  key_id = '88bb403718b1aa3f823049d5103722ba05f4a36891d054025c1f76e5d2d27f3d' 
  AND (
    token = 'Sm03nx7fkw3Pj5UJEPiocmU64RN5w8PmDUoZpAm43hQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047