UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pwf9iGr1ylIgQzggtEhV7T2LyZ/03R9x0zm7pXoKSvs=' 
WHERE 
  key_id = '6f472ff2aea7c2afb8e66a74d2baf4e7504f068bb4aec66470e8dc9dbdf4a128' 
  AND (
    token = 'Pwf9iGr1ylIgQzggtEhV7T2LyZ/03R9x0zm7pXoKSvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036