UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UJXvR3oMrA5SMZqnwy3XO4e+H/NJzFAx49cc2vmmWf8=' 
WHERE 
  key_id = '21b0f44dc61fdddfd8365487037a5061b8d46c10a79a0c8488ba34a4d96d18f6' 
  AND (
    token = 'UJXvR3oMrA5SMZqnwy3XO4e+H/NJzFAx49cc2vmmWf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046