UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eccKntadNss8lVStNJ7mjL+gvEgeiW+g+OyMoz8N+ws=' 
WHERE 
  key_id = 'b5ad0e3108571fd8589d98dcc43af00409f83d020b7e6990b9b5a495f0c85ad3' 
  AND (
    token = 'eccKntadNss8lVStNJ7mjL+gvEgeiW+g+OyMoz8N+ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032