UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JsN8U/9xw4arxPVeVf/xGsEQmQVN4vqcByWlIqpkTFQ=' 
WHERE 
  key_id = '57986d8e40bb571bc2940ef04d91a7b28585b0e52b21658913eb22e2b300144e' 
  AND (
    token = 'JsN8U/9xw4arxPVeVf/xGsEQmQVN4vqcByWlIqpkTFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039