UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zk9x9VcV8OD5o5KCglGNVp4MGGWaiSyWQ4KXtwxSPWc=' 
WHERE 
  key_id = '2bbb025859271a5bd6738abf1b6eeb8a976bb87b43156565f57b3a98cb8a368e' 
  AND (
    token = 'zk9x9VcV8OD5o5KCglGNVp4MGGWaiSyWQ4KXtwxSPWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040