UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Agt8jh8zFPmx6DLvwLNPPqr4YcJ+gd+sH/i1xGFFfJM=' 
WHERE 
  key_id = '7a7b726ea70a75ed2d25c3e599c6d7be2e765470047fb8e308f3b74397d13f19' 
  AND (
    token = 'Agt8jh8zFPmx6DLvwLNPPqr4YcJ+gd+sH/i1xGFFfJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033