UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y9G75fmKIFVeSjT4hxtrtwW+oTejIuYIOjpiYFtT/Rw=' 
WHERE 
  key_id = '598eceeb3b054718aa422b99fd151f78b5c5f2b97ef9f0b5688c31437870c4ae' 
  AND (
    token = 'y9G75fmKIFVeSjT4hxtrtwW+oTejIuYIOjpiYFtT/Rw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025