UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I3oz+uMwqqprC1k4bv6j7zmToLOKltjN6UgMKTP9gpA=' 
WHERE 
  key_id = '425df09aebf78be9d2d366fa10b0e244e4e2b517339315725112e48e5566c695' 
  AND (
    token = 'I3oz+uMwqqprC1k4bv6j7zmToLOKltjN6UgMKTP9gpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018