UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NPWwcJwkZryvMWZH1hl+jhDy5PxfmpipGdLndRqoQS4=' 
WHERE 
  key_id = 'e825e692023891fc8d1fcdeb775f80c511969cc41410a1fbbcd04263626569bc' 
  AND (
    token = 'NPWwcJwkZryvMWZH1hl+jhDy5PxfmpipGdLndRqoQS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036