UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rgdl+aGnI5zcWQzeF+AitHe19tdpY1Fpj3oSNoOFSvA=' 
WHERE 
  key_id = 'dedaf3050efc73e65cb32cd5ea2cce0d256469b4a7c025cfebb1573e4f2cbb6e' 
  AND (
    token = 'rgdl+aGnI5zcWQzeF+AitHe19tdpY1Fpj3oSNoOFSvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031