UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w2ttvKtGTZ8pCqGIBHnj9OZJQcLgBD40D8M8em52NzI=' 
WHERE 
  key_id = '413bf584205d08dece3bd54296af07e1f49ac7165a9da77676c17838c38aca0d' 
  AND (
    token = 'w2ttvKtGTZ8pCqGIBHnj9OZJQcLgBD40D8M8em52NzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031