UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8TA/9GdPpTI6G1M+f8++W6TmHz6Tkmj5ta+IjQfTeM=' 
WHERE 
  key_id = '74af41201cbf184e52c6cd09111f553874f8245982743e7d14902a3cc01c3575' 
  AND (
    token = 'J8TA/9GdPpTI6G1M+f8++W6TmHz6Tkmj5ta+IjQfTeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042