UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b7lwaIyx9WbLlmEZaBu7544sRRFZNlIDbnR7jT5BJDQ=' 
WHERE 
  key_id = 'cc486d5288487f4d00951ca07ff899d02afc9270ec47406340298ce431976669' 
  AND (
    token = 'b7lwaIyx9WbLlmEZaBu7544sRRFZNlIDbnR7jT5BJDQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042