UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aIHZqDw3qSYStilAEM/ibmgw9Cw1yoaWSidf4TroafA=' 
WHERE 
  key_id = '26776b60206a21655527fe9e81147bb2c48ada10683c44abd229503475238266' 
  AND (
    token = 'aIHZqDw3qSYStilAEM/ibmgw9Cw1yoaWSidf4TroafA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069